aux_source_directory(. APP_SOURCES)
list(APPEND APP_SOURCES 
    ${CMAKE_CURRENT_SOURCE_DIR}/mainwindow.h
    ${CMAKE_CURRENT_SOURCE_DIR}/plugin_manager.h    
)

qt_add_executable(${PROJECT_NAME}
    MANUAL_FINALIZATION
    ${APP_SOURCES}
    ${QRC_FILES}
)

target_link_libraries(${PROJECT_NAME} PRIVATE
    ${util_lib_name}
    ${pubsub_lib_name}
    Qt${QT_VERSION_MAJOR}::Core
    Qt${QT_VERSION_MAJOR}::Gui
    Qt${QT_VERSION_MAJOR}::Widgets
)

# 添加插件依赖
add_dependencies(${PROJECT_NAME} ${taskbuttons_plugin_name} ${taskexplorer_plugin_name})

qt_finalize_executable(${PROJECT_NAME})

# 构建后动作
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD

    # 复制插件配置文件
    COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/resources/plugins/plugins.json ${PROJECT_BINARY_DIR}/src/plugins/plugins.json
)
